<?php
class ContractPDF extends TCPDF
    {

        public $date, $custno, $contractno;

        public function Footer()
        {
            $this->SetX($this->original_rMargin);
            $pagetext = 'Page ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages();
            $this->MultiCell(80, 5, 'www.qsibanking.com', 0, 'L', 0, 0, '', '', true);
            $this->MultiCell(45, 5, $pagetext, 0, 'L', 0, 0, '', '', true);
            $this->MultiCell(55, 5, 'billing@qsibanking.com ', 0, 'R', 0, 1, '', '', true);
        }

        public function Header()
        {
            $this->y = $this->header_margin;
            $this->x = $this->original_lMargin;
            //$this->Image($file,$x,$y,$w,$h);
            $this->RoundedRect(17, 16.3, 87, 26, 6.50, '1111');
            //$this->Image('images/QSI1.png', 23, 17, 25, 24);
            $this->MultiCell(40, 4, 'QSI, INC', false, 'C', false, 1, 65, 17);
            $this->MultiCell(40, 4, '107 Schuler Dr.', false, 'C', false, 1, 63, 22);
            $this->MultiCell(40, 4, 'Bardstown KY 40004', false, 'C', false, 1, 63, 27);
            $this->MultiCell(40, 4, 'Phone: 502-350-1000 ', false, 'C', false, 1, 63, 32);
            $this->MultiCell(40, 4, 'Fax: 502-350-1002 ', false, 'C', false, 1, 63, 37);
            $this->RoundedRect(106.1, 16.3, 87.8, 13, 1.50, '1111', 'DF', array(), array(0, 255, 255));
            $this->writeHTMLCell(87.8, 20, 106.1, 20, $html = '<h1 style="text-align: center">CONTRACT</h1>');



            $html = '                <br/><br/><br/><br/>
<table border="0" cellspacing="10" cellpadding="10"  >
     <tr>

        <th style="width:52%;" align="right" colspan = "2" >

        </th>
        <th  colspan = "2">

              <table cellspacing="1" cellpadding="2" >
                <tr>
                <h2></h2> <br><br>
                    <td align="center" style="background-color: #dddddd;border: 1px solid black;" >Date</td>

                    <td  align="center" style="background-color: #dddddd;border: 1px solid black;"> Contract No.</td>
                    <td  align="center" style="background-color: #dddddd;border: 1px solid black;">Cust No.</td>

                </tr>

                <tr>
                <td align="center" style="border: 1px double black;" ><b>' . $this->date . '</b></td>
                    <td align="center" style="border: 1px double black;" ><b>' . $this->contractno . '</b></td>

                    <td align="center" style="border: 1px double black;" ><b>' . $this->custno . '</b></td>
                </tr>
                  </table>

        </th>
    </tr>
    </table>
                ';

            $this->writeHTMLCell(200.5, 60, 0, 0, $html);
            if ($this->getPage() == 1)
            {
                $this->Rect(15, 105, 180, 185, 'D', array('width' => 2));
            }
            else
            {
                $this->Rect(15, 50, 180, 235, 'D', array('width' => 2));
            }
        }

    }